﻿using System;
using System.Collections.Generic;
using System.Text;
using Magnet.Engine.Entities;

namespace Magnet.Engine.Physics
{
    /// <summary>
    /// An Arbiter is a simple class that contains information useful for 
    /// comparing collisions. When an Arbiter is created, it is passed the
    /// first and second entities in a collision, then it can tell whether
    /// or not a collision is relevant to a certain Entity.
    /// </summary>
    public class Arbiter
    {
        private Entity entityA;
        private Entity entityB;

        public Arbiter(Entity a, Entity b)
        {
            entityA = a;
            entityB = b;
        }

        public Entity GetEntityA()
        {
            return entityA;
        }

        public Entity GetEntityB()
        {
            return entityB;
        }

        public bool ConcernsEntity(Entity e)
        {
            return (entityA == e || entityB == e);
        }

        public Entity GetOtherEntity(Entity e)
        {
            Entity re = null;
            if (entityA == e)
                re = entityB;
            else if (entityB == e)
                re = entityA;
            return re;
        }
    }
}
